package com.tanhua.app.controller;

import com.tanhua.app.service.BaiduService;
import com.tanhua.app.service.RecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/tanhua")
public class TanHuaController {

    @Autowired
    private RecommendService recommendService;

    @GetMapping(value = "/todayBest",name="猿粪值最高的今日佳人")
    public ResponseEntity findMaxScore(){
        return recommendService.findMaxScore();
    }


    @GetMapping(value = "/recommendation",name="所有的今日佳人")
    public ResponseEntity findAllScore(Integer page,Integer pagesize){
        return recommendService.findAllScore(page,pagesize);
    }



    @GetMapping(value = "/{id}/personalInfo",name="佳人详情信息")
    public ResponseEntity personalInfo(@PathVariable("id") Long jrid){
        return recommendService.personalInfo(jrid);
    }

    @GetMapping(value = "/strangerQuestions",name="查询佳人的问题")
    public ResponseEntity strangerQuestions(Long userId){

        return recommendService.strangerQuestions(userId);
    }



    @PostMapping(value = "/strangerQuestions",name="回复问题调用环信发交友验证")
    public ResponseEntity toStrangerQuestions(@RequestBody Map<String,String> map){
        Long jrid =Long.parseLong(map.get("userId"));
        String content = map.get("reply");
        return recommendService.toStrangerQuestions(jrid,content);
    }



    @Autowired
    private BaiduService baiduService;

    @GetMapping(value = "/search",name="查询附件的探花用户")
    public ResponseEntity search(String gender,Integer distance){

        return baiduService.search(gender,distance);
    }
}
